From f5af18738b3514bdc8f1bf3f90a0a70fe994c83f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Timm=20B=C3=A4der?= Date: Sat, 1 Aug 2020 15:26:28 +0200 Subject: [PATCH] listbox: Add _append To have easy replacement API for gtk_container_add. --- docs/reference/gtk/gtk4-sections.txt | 1 + gtk/gtklistbox.c | 16 ++++++++++++++++ gtk/gtklistbox.h | 3 +++ 3 files changed, 20 insertions(+) diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt index 85bcb0038c..cb4fced509 100644 --- a/docs/reference/gtk/gtk4-sections.txt +++ b/docs/reference/gtk/gtk4-sections.txt @@ -257,6 +257,7 @@ GtkListBoxUpdateHeaderFunc gtk_list_box_new gtk_list_box_prepend +gtk_list_box_append gtk_list_box_insert gtk_list_box_remove gtk_list_box_select_row diff --git a/gtk/gtklistbox.c b/gtk/gtklistbox.c index a95c87457a..443ac6fa2d 100644 --- a/gtk/gtklistbox.c +++ b/gtk/gtklistbox.c @@ -2584,6 +2584,22 @@ gtk_list_box_prepend (GtkListBox *box, gtk_list_box_insert (box, child, 0); } +/** + * gtk_list_box_append: + * @box: a #GtkListBox + * @child: the #GtkWidget to add + * + * Append a widget to the list. If a sort function is set, the widget will + * actually be inserted at the calculated position and this function has the + * same effect of gtk_container_add(). + */ +void +gtk_list_box_append (GtkListBox *box, + GtkWidget *child) +{ + gtk_list_box_insert (box, child, -1); +} + /** * gtk_list_box_insert: * @box: a #GtkListBox diff --git a/gtk/gtklistbox.h b/gtk/gtklistbox.h index b39f55154a..301a5707a5 100644 --- a/gtk/gtklistbox.h +++ b/gtk/gtklistbox.h @@ -168,6 +168,9 @@ GDK_AVAILABLE_IN_ALL void gtk_list_box_prepend (GtkListBox *box, GtkWidget *child); GDK_AVAILABLE_IN_ALL +void gtk_list_box_append (GtkListBox *box, + GtkWidget *child); +GDK_AVAILABLE_IN_ALL void gtk_list_box_insert (GtkListBox *box, GtkWidget *child, int position); -- 2.30.2